<?php

/**
 * celebrity actions.
 *
 * @package    iEasy
 * @subpackage celebrity
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class celebrityActions extends adminBase
{
    /**
     * Executes index action
     *
     * @param sfRequest $request A request object
     */
    public function executeIndex(sfWebRequest $request)
    {
        $navigator = "/backend.php/celebrity/index?";
        $this->navigator = "";
        $this->catalogId = $request->getParameter("catalogId");
        $this->subCatalogId = $request->getParameter("subCatalogId");
        $this->contentTypeId = $request->getParameter("contentTypeId");
        $submitType = $request->getParameter("submitType");
        if ($submitType != null) {
            if ($submitType != "search") {
                $content = $request->getParameter("content");
                if (!empty($content)) {
                    $Ids = explode(" ", $content);
                    for ($i = 0; $i < count($Ids); $i++)
                    {
                        if (!empty($Ids[$i])) {
                            $currentCelebrity = @Doctrine_Core::getTable('Celebrity')->find($Ids[$i]);
                            if (!empty($currentCelebrity)) {
                                $currentCelebrity->setModifyTime(date("Y-m-d H:i:s"));
                                switch ($submitType)
                                {
                                    case "delete": //
                                        $currentCelebrity->setStatusId(1006);
                                        break;
                                    case "publish":
                                        if ($currentCelebrity->getStatusId() != 1005) {
                                            $currentCelebrity->setPublishTime(date("Y-m-d H:i:s"));
                                            $currentCelebrity->setStatusId(1005); //
                                        }
                                        break;
                                    case "cancelPublish":
                                        $currentCelebrity->setModifyTime(date("Y-m-d H:i:s"));
                                        $currentCelebrity->setStatusId(1004); //不审核
                                        break;
                                    case "recommend":
                                        $this->modifyCelebrityRecommend($currentCelebrity, "add");
                                        $currentCelebrity->setIsRecommendB("1");
                                        break;
                                    case "cancelRecommend":
                                        $this->modifyCelebrityRecommend($currentCelebrity, "delete");
                                        $currentCelebrity->setIsRecommendB("0");
                                        break;

                                    case "top":
                                        $currentCelebrity->setIsOnTopB("1");
                                        $this->modifyCelebrityRecommend($currentCelebrity, "top");

                                        break;
                                    case "cancelTop":
                                        $currentCelebrity->setIsOnTopB("0");
                                        $this->modifyCelebrityRecommend($currentCelebrity, "cancelTop");
                                        break;
                                }
                                $currentCelebrity->save();
                            }
                        }
                    }
                }
            }
        }
        $this->recordCount = $request->getParameter('recordCount');
        $this->currentPage = $request->getParameter('currentPage');
        if (null == $this->recordCount || "" == $this->recordCount)
            $this->recordCount = 20;
        if (null == $this->currentPage || "" == $this->currentPage)
            $this->currentPage = 1;

        $query = Doctrine_Query::create()->from("Celebrity c");
        $catalog = null;
        if ($this->catalogId > 0) {
            $query = $query->where('c.catalog_id=' . $this->catalogId);
            $catalog = Doctrine_Core::getTable("Catalog")->find($this->catalogId);
            if ($catalog != null)
                $this->navigator = "<a href='" . $navigator . "catalogId=" . $this->catalogId . "'>" . $catalog->getDescription() . "</a>";
        }
        $contentType = Doctrine_Core::getTable("ContentType")->find($this->contentTypeId);
        if ($contentType != null) {
            if ($this->navigator != "")
                $this->navigator = $this->navigator . " -> ";
            $this->navigator = $this->navigator . "<a href='" . $navigator . "contentTypeId=" . $this->contentTypeId;
            if ($catalog != null)
                $this->navigator = $this->navigator . "&catalogId=" . $catalog->getCatalogId();
            $this->navigator = $this->navigator . "'>" . $contentType->getDescription() . "</a>";
        }
        if ($this->subCatalogId > 0) {
            $query = $query->addWhere('c.sub_catalog_id=' . $this->subCatalogId);
            $subCatalog = Doctrine_Core::getTable("Catalog")->find($this->subCatalogId);
            if ($subCatalog != null) {
                if ($this->navigator != "")
                    $this->navigator = $this->navigator . " -> ";
                if ($catalog == null)
                    $this->navigator = $this->navigator . "<a href='" . $navigator . "?subCatalogId=" . $subCatalog->getCatalogId() . "'>" . $subCatalog->getDescription() . "</a>";
                else
                    $this->navigator = $this->navigator . "<a href='" . $navigator . "?catalogId=" . $catalog->getCatalogId() . "&subCatalogId=" . $subCatalog->getCatalogId() . "'>" . $subCatalog->getDescription() . "</a>";
            }

        }

        $this->searchProperty = $request->getParameter("searchProperty");
        $searchDelete = "false";
        switch ($this->searchProperty)
        {
            case "top":
                $query = $query->andWhere("is_on_top_b=1");
                break;
            case "recommend":
                $query = $query->andWhere("is_recommend_b=1");
                break;
            case "publish":
                $query = $query->andWhere("status_id=1005");
                break;
            case "delete":
                $searchDelete = "true";
                $query = $query->andWhere("c.status_id=1006");
                break;
        }
        $this->searchField = $request->getParameter("searchField");
        switch ($this->searchField)
        {
            case "name":
                $query = $query->andWhere("name like '%" . trim($request->getParameter("searchText")) . "%'");
                break;
            case "keyword":
                $query = $query->andWhere("keyword like '%" . trim($request->getParameter("searchText")) . "%'");
                break;
            case "tag":
                $query = $query->andWhere("tag like '%" . trim($request->getParameter("searchText")) . "%'");
                break;
        }
        $this->searchText = trim($request->getParameter("searchText"));
        if ($this->searchField != null)
            $this->searchStr = $this->searchStr . "searchField=" . $this->searchField;
        else
        {
            if ($submitType != null && $submitType == "search") //默认搜索人名
                $query = $query->andWhere("name like '%" . trim($request->getParameter("searchText")) . "%'");
        }
        if ($this->searchProperty != null) {
            if ($this->searchStr != "")
                $this->searchStr = $this->searchStr . "&searchProperty=" . $this->searchProperty;
            else
                $this->searchStr = $this->searchStr . "searchProperty=" . $this->searchProperty;
        }
        if ($this->searchText != null)
            $this->searchStr = $this->searchStr . "&searchText=" . $this->searchText;
        if ($this->searchStr != "")
            $this->searchStr = "&" . $this->searchStr;
        if ($searchDelete == "false")
            $query = $query->andWhere("status_id != 1006");
        $query = $query->orderBy('c.publish_time desc,c.celebrity_id desc');
        $dql = $query->getDql();
        $this->pages = new sfDoctrinePager('Celebrity', $this->recordCount); //$this->currentPage
        $this->pages->setQuery($query); //$q   数据库查询语句
        $this->pages->setPage($this->currentPage); //
        $this->pages->init();
    }

    public function executeAdd(sfWebRequest $request)
    {


        $this->execSql = $request->getParameter("celebrityEdit");
        $this->results = "";
        switch ($this->execSql) {
            case "1":
                $conn = Doctrine_Manager::connection();
                try {
                    $conn->beginTransaction();
                    $celebrity = new Celebrity();
                    $celebrity->setStatusId(1005);
                    $this->processCelebrity($celebrity, $request);

                    //                $celebrity->setCatalogId($request->getParameter("sCatalogId"));
                    //                $names = $request->getParameter("name");
                    //                $celebrity->setName($names);
                    //                $celebrity->setSex($request->getParameter("sex"));
                    //                $celebrity->setBirthday($request->getParameter("birthday"));
                    //                $celebrity->setHoroscope($request->getParameter("horoscope"));
                    //                $celebrity->setBloodType($request->getParameter("blood_type"));
                    //                $celebrity->setCountry($request->getParameter("country"));
                    //                $celebrity->setCompanyName($request->getParameter("company_name"));
                    //                $celebrity->setHeight($request->getParameter("heights"));
                    //                $celebrity->setWeight($request->getParameter("weights"));
                    //                $celebrity->setWorkDate($request->getParameter("work_date"));
                    //                $celebrity->setSchool($request->getParameter("school"));
                    //                $celebrity->setEnglishName($request->getParameter("english_name"));
                    //                $celebrity->setCareer($request->getParameter("career"));
                    //                $celebrity->setTag($request->getParameter("tag"));
                    //                $celebrity->setKeyword($request->getParameter("keyword"));
                    //                $celebrity->setLocation($request->getParameter("locations"));
                    //                $celebrity->setSource($request->getParameter("source"));
                    //                $celebrity->setSnapshotBig($request->getParameter("Txt0"));
                    //                $celebrity->setBrief($request->getParameter("brief"));
                    //                $celebrity->setIsAuditB($request->getParameter("auditing"));
                    //                $celebrity->setCreateTime(date("Y-m-d H:i:s"));
                    //                $celebrity->setStatusId(1005);
                    //                $celebrity->setModifyTime(date("Y-m-d H:i:s"));
                    //                $celebrity->setPublishTime($request->getParameter("nowtime"));
                    //                $celebrity->setHitI(0);
                    //                $celebrity->setHitMaskI($request->getParameter("hitMark"));
                    //                $capletter = @utility::getfirstchar($names);
                    //                $celebrity->setCapitalLetter($capletter);
                    $recommend = $request->getParameter("ckRecommendContent");
                    $tops = $request->getParameter("ckTop");
                    //                if ($recommend)
                    //                    $celebrity->setIsRecommendB($recommend);
                    //                else
                    //                    $celebrity->setIsRecommendB(0);
                    //                if ($tops)
                    //                    $celebrity->setIsOnTopB($tops);
                    //                else
                    //                    $celebrity->setIsOnTopB(0);
                    //                $celebrity->save();
                    $celebrityId = $celebrity->getCelebrityId();
                    if ($celebrityId >= 1000) {
                        if ($recommend) {
                            $recomendContent = new RecommendContent();
                            $recomendContent->setCatalogId($celebrity->getCatalogId());
                            $recomendContent->setContentId($celebrity->getCelebrityId());
                            $recomendContent->setCreateTime(date("Y-m-d H:i:s"));
                            $recomendContent->setModifyTime(date("Y-m-d H:i:s"));
                            $recomendContent->setContentTypeI(1002);
                            $recomendContent->setIsOnTopB($tops);
                            $recomendContent->save();
                        }

                        for ($i = 1; $i <= 3; $i++) {
                            $websites = $request->getParameter("website" . $i);
                            if (!empty($websites)) {
                                $officalsite = new OfficialSite();
                                $officalsite->setCelebrityId($celebrityId);
                                $officalsite->setTitle($request->getParameter("title" . $i));
                                $officalsite->setLink($websites);
                                $officalsite->setSnapshot($request->getParameter("Txt" . $i));
                                $officalsite->save();
                            } else
                                break;
                        }
                    }

                    $preId = $request->getParameter("hidpre");
                    $Ids = explode(" ", $preId);
                    for ($i = 0; $i < count($Ids); $i++)
                    {
                        if (!empty($Ids[$i])) {
                            //添加你会喜欢
                            $relateCon = new RelatedContent();
                            $relateCon->setContentId($celebrity->getCelebrityId());
                            $relateCon->setContentTypeI(1002);
                            $relateCon->setRContentId($Ids[$i]);
                            $relateCon->setRContentTypeI(1002);
                            $relateCon->setCreateTime(date("Y-m-d H:i:s"));
                            $relateCon->setModifyTime(date("Y-m-d H:i:s"));
                            $relateCon->setCatalogId($celebrity->getCatalogId());
                            $relateCon->setKeyword($celebrity->getKeyword());
                            $relateCon->save();
                        }
                    }
                    $conn->commit();
                } catch (Exception $e) {
                    echo $e->getTraceAsString();
                    $conn->rollback();
                }
                //$this->forward("celebrity","index");
                $this->redirect("celebrity/index?catalogId=" . $celebrity->getCatalogId());
                break;
        }


    }

    public function executeEdit(sfWebRequest $request)
    {
        $execSql = $request->getParameter("celebrityEdit");
        $this->results = "";
        $this->recTrue = "false";
        $this->topTrue = "false";
        $content = $request->getParameter("content");
        switch ($execSql) {
            case "1": //加载
                if (!empty($content)) {
                    $editCelebrity = @Doctrine_Core::getTable('Celebrity')->find($content);
                    $this->celebrity = $editCelebrity;
                    $editOffic = @Doctrine_Query::create()->from("OfficialSite o")
                            ->Where('celebrity_id=' . $editCelebrity->getCelebrityId())
                            ->execute();
                    if ($editCelebrity->getIsRecommendB())
                        $this->recTrue = true;
                    if ($editCelebrity->getIsOnTopB())
                        $this->topTrue = true;
                    $this->officesite = $editOffic;
                    $editRel = @Doctrine_Query::create()->from("RelatedContent r")
                            ->Where('content_id=' . $editCelebrity->getCelebrityId())
                            ->andWhere('content_type_i=1002')
                            ->andWhere('r_content_type_i=1002')
                            ->andWhere('catalog_id=' . $editCelebrity->getCatalogId())
                            ->execute();
                    $this->relatedcontent = $editRel;
                }
                break;
            case "2": //修改

                $celebrity = @Doctrine_Core::getTable('Celebrity')->find($content);
                if (!empty($celebrity)) {
                    $this->processCelebrity($celebrity, $request);
                    //                    $names = $request->getParameter("name");
                    //                    $capletter = @utility::getfirstchar($names);
                    //                    if ($capletter != $request->getParameter("capital_letter")) {
                    //                        $celebrity->setCapitalLetter($request->getParameter("capital_letter"));
                    //                    }
                    //
                    //                    $celebrity->setCatalogId($request->getParameter("sCatalogId"));
                    //                    $celebrity->setName($names);
                    //                    $celebrity->setSex($request->getParameter("sex"));
                    //                    $celebrity->setBirthday($request->getParameter("birthday"));
                    //                    $celebrity->setHoroscope($request->getParameter("horoscope"));
                    //                    $celebrity->setBloodType($request->getParameter("blood_type"));
                    //                    $celebrity->setCountry($request->getParameter("country"));
                    //                    $celebrity->setCompanyName($request->getParameter("company_name"));
                    //                    $celebrity->setHeight($request->getParameter("heights"));
                    //                    $celebrity->setWeight($request->getParameter("weights"));
                    //                    $celebrity->setWorkDate($request->getParameter("work_date"));
                    //                    $celebrity->setSchool($request->getParameter("school"));
                    //                    $celebrity->setEnglishName($request->getParameter("english_name"));
                    //                    $celebrity->setCareer($request->getParameter("career"));
                    //                    $celebrity->setTag($request->getParameter("tag"));
                    //                    $celebrity->setKeyword($request->getParameter("keyword"));
                    //                    $celebrity->setLocation($request->getParameter("locations"));
                    //                    $celebrity->setSource($request->getParameter("source"));
                    //                    $celebrity->setSnapshotBig($request->getParameter("Txt0"));
                    //                    $celebrity->setBrief($request->getParameter("brief"));
                    //                    $celebrity->setIsAuditB($request->getParameter("auditing"));
                    //                    $celebrity->setCreateTime(date("Y-m-d H:i:s"));
                    //                    $celebrity->setModifyTime(date("Y-m-d H:i:s"));
                    //                    $celebrity->setPublishTime($request->getParameter("nowtime"));
                    //                    $celebrity->setHitI(0);
                    //                    $celebrity->setHitMaskI($request->getParameter("hitMark"));
                    $recommend = $request->getParameter("ckRecommendContent");
                    $tops = $request->getParameter("ckTop");
                    //                    if ($recommend)
                    //                        $celebrity->setIsRecommendB(1);
                    //                    else
                    //                        $celebrity->setIsRecommendB(0);
                    //                    if ($tops)
                    //                        $celebrity->setIsOnTopB(1);
                    //                    else
                    //                        $celebrity->setIsOnTopB(0);
                    //                    $celebrity->save();

                    $editOffics = @Doctrine_Query::create()->from("OfficialSite o")
                            ->Where('celebrity_id=' . $celebrity->getCelebrityId())
                            ->execute();
                    $i = 1;
                    foreach ($editOffics as $officalsite)
                    {
                        $websites = $request->getParameter("website" . $i);
                        if (!empty($websites)) {
                            $websites = $request->getParameter("website" . $i);
                            $officalsite->setCelebrityId($celebrity->getCelebrityId());
                            $officalsite->setTitle($request->getParameter("title" . $i));
                            $officalsite->setLink($websites);
                            $officalsite->setSnapshot($request->getParameter("Txt" . $i));
                            $officalsite->save();
                            $i++;
                        } else
                        {
                            @$officalsite->delete();
                        }

                    }
                    for ($i; $i <= 3; $i++) {
                        $websites = $request->getParameter("website" . $i);
                        if (!empty($websites)) {
                            $officalsite = new OfficialSite();
                            $officalsite->setCelebrityId($celebrity->getCelebrityId());
                            $officalsite->setTitle($request->getParameter("title" . $i));
                            $officalsite->setLink($websites);
                            $officalsite->setSnapshot($request->getParameter("Txt" . $i));
                            $officalsite->save();
                        } else
                            break;
                    }
                    $editRel = @Doctrine_Query::create()->from("RelatedContent r")
                            ->Where('content_id=' . $celebrity->getCelebrityId())
                            ->andWhere('content_type_i=1002')
                            ->andWhere('r_content_type_i=1002')
                            ->andWhere('catalog_id=' . $celebrity->getCatalogId())
                            ->execute();
                    $i = 0;
                    $preId = $request->getParameter("hidpre");
                    $Ids = explode(" ", $preId);
                    foreach ($editRel as $relateCon)
                    {
                        if (!empty($Ids[$i])) {
                            //添加你会喜欢
                            $relateCon->setContentId($celebrity->getCelebrityId());
                            $relateCon->setContentTypeI(1002);
                            $relateCon->setRContentId($Ids[$i]);
                            $relateCon->setRContentTypeI(1002);
                            $relateCon->setModifyTime(date("Y-m-d H:i:s"));
                            $relateCon->setCatalogId($celebrity->getCatalogId());
                            $relateCon->setKeyword($celebrity->getKeyword());
                            $relateCon->save();
                            $i++;
                        } else
                            @$relateCon->delete();
                    }
                    for ($i; $i < count($Ids); $i++)
                    {
                        if (!empty($Ids[$i])) {
                            //添加你会喜欢
                            $relateCon = new RelatedContent();
                            $relateCon->setContentId($celebrity->getCelebrityId());
                            $relateCon->setContentTypeI(1002);
                            $relateCon->setRContentId($Ids[$i]);
                            $relateCon->setRContentTypeI(1002);
                            $relateCon->setCreateTime(date("Y-m-d H:i:s"));
                            $relateCon->setModifyTime(date("Y-m-d H:i:s"));
                            $relateCon->setCatalogId($celebrity->getCatalogId());
                            $relateCon->setKeyword($celebrity->getKeyword());
                            $relateCon->save();
                        }
                    }

                    if ($recommend) {
                        $recomendContent = new RecommendContent();
                        $recomLine = Doctrine_Query::create()->from("RecommendContent r")
                                ->Where('r.content_id=' . $celebrity->getCelebrityId())
                                ->andWhere('r.content_type_i=1002')->execute();
                        foreach ($recomLine as $recom)
                        {
                            if ($recom->getRecommendContentId() > 0)
                                $recomendContent = @Doctrine_Core::getTable('RecommendContent')->find($recom->getRecommendContentId());
                            break;
                        }
                        $recomendContent->setCatalogId($celebrity->getCatalogId());
                        $recomendContent->setContentId($celebrity->getCelebrityId());
                        $recomendContent->setModifyTime(date("Y-m-d H:i:s"));
                        $recomendContent->setContentTypeI(1003);
                        $recomendContent->setIsOnTopB($tops);
                        $recomendContent->save();
                    } else
                    {
                        $recomLine = Doctrine_Query::create()->from("RecommendContent r")
                                ->Where('r.content_id=' . $celebrity->getCelebrityId())
                                ->andWhere('r.content_type_i=1002')->execute();
                        foreach ($recomLine as $recom)
                        {
                            if ($recom->getRecommendContentId() > 0) {
                                $recomendContent = @Doctrine_Core::getTable('RecommendContent')->find($recom->getRecommendContentId());
                                @$recomendContent->delete();
                            }
                        }
                    }
                }
                //$this->forward("celebrity","index");
                $this->redirect("celebrity/index?catalogId=" . $celebrity->getCatalogId());
                break;
        }
    }

    public function executePrefer(sfWebRequest $request)
    {
        $catalogId = $request->getParameter("catalogId");
        $sex = $request->getParameter("sex");
        $career = $request->getParameter("career");
        $ctype = $request->getParameter("ctype");
        $execsql = Doctrine_Core::getTable("celebrity")->createQuery('c')
                ->addWhere('c.catalog_id=?', $catalogId)->addWhere('c.status_id=1005')
                ->addWhere('c.c_type=?', $ctype);
        if ($ctype == '1') {
            $execsql = $execsql->andWhere('c.sex=?', $sex);
        }
        $ids = $request->getParameter("content");
        if (!empty($ids))
            if ($ids > 0)
                $execsql = $execsql->andWhere('c.celebrity_id !=' . $ids);
        //        if ("组合" == $career)
        //            $execsql->orderBy('member_num_i desc'); //人数
        //        else
        //            $execsql = $execsql->orderBy('c.hit_i desc');
        //点击数orderBy('hit_i+hit_mask_i desc');//
        $execsql = $execsql->orderBy('c.hit_i+c.hit_mask_i desc');
        $this->celebritys = @$execsql->execute();

    }


    function modifyCelebrityRecommend($currentCelebrity, $actionType)
    {
        $recommend = Doctrine_Core::getTable("recommendContent")->createQuery()
                ->where("content_id=?", $currentCelebrity->getCelebrityId())
                ->andWhere("content_type_i=1002")
                ->execute()->getFirst();
        if ($actionType == "add") {
            if ($recommend == null) {
                $recommend = new RecommendContent();
                $recommend->setContentId($currentCelebrity->getCelebrityId());
                $recommend->setContentTypeI(1002);
                $recommend->setCreateTime(date("Y-m-d H:i:s"));
                $recommend->setModifyTime(date("Y-m-d H:i:s"));
                $recommend->setCatalogId($currentCelebrity->getCatalogId());
                $recommend->save();
            }
        }
        else
        {
            if ($recommend != null) {
                switch ($actionType)
                {
                    case "top":
                        $recommend->setIsOnTopB("1");
                        $recommend->save();
                        break;
                    case "cancelTop":
                        $recommend->setIsOnTopB("0");
                        $recommend->save();
                        break;
                    case "delete":
                        $recommend->delete();
                        break;
                }
            }
        }
    }


    private function processCelebrity(Celebrity $celebrity, sfWebRequest $request)
    {
        $ctype = $request->getParameter("ctype");

        $celebrity->setCType($ctype);

        switch ($ctype) {
            case "1": //single
                $names = $request->getParameter("name");
                $capletter = @utility::getfirstchar($names);
                if ($capletter != $request->getParameter("capital_letter")) {
                    $celebrity->setCapitalLetter($request->getParameter("capital_letter"));
                }

                $celebrity->setName($names);
                $celebrity->setStageName($request->getParameter("stage_name"));
                $celebrity->setForeignName($request->getParameter("foreign_name"));

                $celebrity->setSex($request->getParameter("sex"));
                $celebrity->setBirthday($request->getParameter("birthday"));
                $celebrity->setHoroscope($request->getParameter("horoscope"));
                $celebrity->setBloodType($request->getParameter("blood_type"));
                $celebrity->setCountry($request->getParameter("country"));
                $celebrity->setCompanyName($request->getParameter("company_name"));
                $celebrity->setBandName($request->getParameter("belong_band"));
                $celebrity->setFriends($request->getParameter("friends"));

                $celebrity->setHeight($request->getParameter("heights"));
                $celebrity->setWeight($request->getParameter("weights"));
                $celebrity->setWorkDate($request->getParameter("work_date"));
                $celebrity->setSchool($request->getParameter("school"));
                $celebrity->setEnglishName($request->getParameter("english_name"));
                $celebrity->setCareer($request->getParameter("career"));

                $celebrity->setLocation($request->getParameter("locations"));
                $celebrity->setSource($request->getParameter("source"));


                break;
            case "2": //band
                $names = $request->getParameter("band_name");
                $capletter = @utility::getfirstchar($names);
                if ($capletter != $request->getParameter("capital_letter")) {
                    $celebrity->setCapitalLetter($request->getParameter("capital_letter"));
                }
                $celebrity->setName($request->getParameter("band_name"));

                $celebrity->setBandMember($request->getParameter("band_member"));
                $celebrity->setWorkDate($request->getParameter("band_work_date"));
                $celebrity->setBandColor($request->getParameter("band_color"));
                $celebrity->setBandSlogan($request->getParameter("band_slogan"));
                $celebrity->setCompanyName($request->getParameter("band_company_name"));
                break;
        }


        $celebrity->setTag($request->getParameter("tag"));
        $celebrity->setKeyword($request->getParameter("keyword"));
        $celebrity->setCatalogId($request->getParameter("sCatalogId"));
        $celebrity->setFansName($request->getParameter("fans_name"));
        $celebrity->setIsAuditB($request->getParameter("auditing"));
        $celebrity->setCreateTime(date("Y-m-d H:i:s"));

        $celebrity->setModifyTime(date("Y-m-d H:i:s"));
        $celebrity->setPublishTime($request->getParameter("nowtime"));
        $celebrity->setHitI(0);
        $celebrity->setHitMaskI($request->getParameter("hitMark"));
        $celebrity->setSnapshotBig($request->getParameter("Txt0"));
        $celebrity->setSnapshotSmall($request->getParameter("small_txt"));
        $celebrity->setBrief($request->getParameter("brief"));
        $recommend = $request->getParameter("ckRecommendContent");
        $tops = $request->getParameter("ckTop");
        if ($recommend)
            $celebrity->setIsRecommendB(1);
        else
            $celebrity->setIsRecommendB(0);
        if ($tops)
            $celebrity->setIsOnTopB(1);
        else
            $celebrity->setIsOnTopB(0);
        $celebrity->save();


    }
}
